﻿@model ProductSummaryModel.SummaryItem

@using SmartStore.Services.Localization;
@using SmartStore.Web.Models.Catalog;
@using SmartStore.Core.Domain.Catalog;

@{ 
    var list = Model.Parent;
    var artPriceClasses = "art-price";

    if (Model.PriceDisplayStyle == PriceDisplayStyle.BadgeAll || (Model.PriceDisplayStyle == PriceDisplayStyle.BadgeFreeProductsOnly && Model.Price.PriceValue == 0))
    {
        if (Model.Price.SavingAmount.HasValue())
        {
            artPriceClasses += " badge badge-danger";
        }
        else
        {
            artPriceClasses += " badge badge-success";
        }
    }

    if (Model.DisplayTextForZeroPrices && Model.Price.PriceValue == 0)
    {
        Model.Price.Price = T("Products.Free").Text;
    }

    if (Model.Price.RegularPrice.HasValue())
    {
        artPriceClasses += " art-price--offer";
    }

    if (Model.Price.CallForPrice)
    {
        artPriceClasses += " art-price--call";
    }
}

@if (list.ShowDeliveryTimes)
{
	<div class="art-delivery-info">
		@if (Model.IsShippingEnabled && !Model.HideDeliveryTime)
		{
			var statusLabel = Model.DisplayDeliveryTimeAccordingToStock ? Model.DeliveryTimeName : Model.StockAvailablity;
			<span class="delivery-time" title="@T("Products.DeliveryTime") @statusLabel" @Html.Attr("style", "color:" + Model.DeliveryTimeHexValue, Model.DisplayDeliveryTimeAccordingToStock)>
				<i class="fa fa-circle delivery-time-status"></i>
				<span dir="auto">@statusLabel</span>
			</span>
		}
	</div>
}

@if (list.ShowPrice)
{

	<div class="art-price-block">
		<span class="@artPriceClasses">
            @(Model.Price.SavingAmount.HasValue() ? "% " : "")@Model.Price.Price
		</span>
		@if (Model.Price.RegularPrice.HasValue())
		{
			if (list.ViewMode == ProductSummaryViewMode.List)
			{
				<div class="art-info-group">
					<div>
						<span>@T("Products.Price.OldPrice"):</span>
						<span class="art-oldprice">@Model.Price.RegularPrice</span>
					</div>
					@if (Model.Price.SavingAmount.HasValue())
					{
						<div class="d-flex">
							<span>@T("ShoppingCart.ItemYouSave"):</span>
							<span class="pl-2">@Model.Price.SavingAmount <span class="lrm">(@Model.Price.SavingPercent.ToString("N0") %)</span></span>
						</div>
					}
				</div>
			}
			else
			{
				<span class="art-oldprice">@Model.Price.RegularPrice</span>
			}
		}

		@if (list.ShowShippingSurcharge && Model.TransportSurcharge.HasValue())
		{
			<div class="art-shipsurcharge">
				@Html.Raw(Model.TransportSurcharge)
			</div>
		}

		@if (list.ShowBasePrice && Model.BasePriceInfo.HasValue())
		{
			<div class="art-pangv" @Html.Attr("title", Model.BasePriceInfo, Model.BasePriceInfo.HasValue())>
				@Html.Raw(LocalizedValue.FixBrackets(Model.BasePriceInfo, WorkContext.WorkingLanguage) ?? "&nbsp;")
			</div>
		}
	</div>

    Html.RenderWidget("productbox_add_info"); 
}








